#pragma once
#include <nice2d/sprite.h>

class Piece : public Sprite
{
    DECLARE_OBJECT(Piece)
public:
    Piece(const sf::String &name);
    virtual ~Piece();
public:
    void setName(const sf::String &name);
    sf::String getName()const;

    void setDescription(const sf::String &description);
    sf::String getDescription()const;

    void configurate();
    bool isConfigurated()const;

    void setPieceIcon(const std::string &file);
    std::string getPieceIcon();

    void select();
    boost::signals2::signal<void(std::shared_ptr<Piece>)> onSelected;
    void unselect();
    boost::signals2::signal<void(std::shared_ptr<Piece>)> onUnselected;
    bool isSelected()const;
public:
    virtual PTree serialize() override;
    virtual void deserialize(const PTree &node) override;
private:
    std::unique_ptr<class PieceData> data;
};
